package global

import (
	"github.com/Sir-yuChen/funAnalyse/config"
	"github.com/Sir-yuChen/funAnalyse/utils/timer"
	"github.com/casbin/casbin/v2"
	ut "github.com/go-playground/universal-translator"
	"github.com/go-redis/redis/v8"
	"github.com/spf13/viper"
	"go.mongodb.org/mongo-driver/mongo"
	"go.uber.org/zap"
	"golang.org/x/sync/singleflight"
	"gorm.io/gorm"
	"sync"
)

var (
	GVA_CONFIG              config.Server
	GVA_DBList              map[string]*gorm.DB
	GVA_VP                  *viper.Viper
	GVA_DB                  *gorm.DB
	GVA_CASBIN              *casbin.Enforcer
	lock                    sync.RWMutex
	GVA_LOG                 *zap.Logger
	GVA_Concurrency_Control = &singleflight.Group{} //  slingleFligh 库 避免高并发请求 大量请求数据库
	GVA_REDIS               *redis.Client
	GVA_MongoDB             *mongo.Client
	//GVA_Collections         *mongodb.MongodbCollections
	GVA_Timer = timer.NewTimerTask()
	GVA_Trans ut.Translator // 定义一个全局翻译器
	//BlackCache local_cache.Cache
	//// GVA_LOG    *oplogging.Logger
)
